refactor(acp): migrate server to coder/acp-go-sdk#368
Merged
Conversation
f251001 to
e3ce139
Compare
- `.go-arch-lint.yml`: Remove pkg-acpserver component, add go-sdk-acp vendor dependency - `.zpm/kb/pr_feature_f105_acp_server_migration_to_coderacp_go_s/journal.wal`: Add PR knowledge journal - `.zpm/kb/pr_feature_f105_acp_server_migration_to_coderacp_go_s/knowledge.pl`: Add PR Prolog knowledge base - `CHANGELOG.md`: Document F105 ACP server SDK migration - `README.md`: Update ACP server documentation reference - `docs/ADR/018-acp-transparent-agent-server-protocol.md`: Update ADR cross-reference - `docs/ADR/020-acp-server-migration-to-coder-sdk.md`: Add ADR documenting SDK migration decision - `docs/ADR/README.md`: Register new ADR 020 - `go.mod`: Replace custom acpserver with github.com/coder/acp-go-sdk - `go.sum`: Update checksums for new dependency - `internal/application/acp_session.go`: Adapt session types to SDK interfaces - `internal/application/acp_session_service.go`: Wire SDK-based agent handler - `internal/application/acp_audit_fixes_test.go`: Update tests for SDK session contract - `internal/application/acp_session_service_concurrency_test.go`: Update concurrency tests - `internal/application/acp_session_service_parking_test.go`: Add parking flow tests - `internal/application/acp_session_service_test.go`: Expand session service test coverage - `internal/infrastructure/acp/agent.go`: Add SDK-backed Agent handler implementation - `internal/infrastructure/acp/agent_test.go`: Add full unit tests for Agent handler - `internal/infrastructure/acp/architecture_test.go`: Add SDK import confinement test - `internal/infrastructure/acp/doc.go`: Update package documentation for SDK migration - `internal/infrastructure/acp/doc_test.go`: Add documentation drift detection tests - `internal/infrastructure/acp/emitter.go`: Add Emitter wrapping SDK session updates - `internal/infrastructure/acp/emitter_internal_test.go`: Add internal Emitter unit tests - `internal/infrastructure/acp/emitter_test.go`: Add public Emitter integration tests - `internal/infrastructure/acp/errors.go`: Add typed ACP error hierarchy - `internal/infrastructure/acp/errors_test.go`: Add error type unit tests - `internal/infrastructure/acp/event_projector.go`: Adapt projector to SDK event types - `internal/infrastructure/acp/event_projector_test.go`: Update projector tests for SDK types - `internal/infrastructure/acp/message.go`: Remove custom message DTO (replaced by SDK) - `internal/infrastructure/acp/message_test.go`: Remove message DTO tests - `internal/infrastructure/acp/permission.go`: Add SDK-backed PermissionClient adapter - `internal/infrastructure/acp/permission_test.go`: Add permission client unit tests - `internal/infrastructure/acp/renderer.go`: Rewrite renderer to emit directly via SDK - `internal/infrastructure/acp/renderer_test.go`: Update renderer tests for direct SDK emission - `internal/interfaces/cli/acp_serve.go`: Replace custom server with SDK server lifecycle - `internal/interfaces/cli/acp_serve_lifecycle_test.go`: Add server lifecycle tests - `internal/interfaces/cli/acp_serve_test.go`: Update serve command tests for SDK wiring - `internal/interfaces/cli/acp_wiring.go`: Rewire ACP components against SDK interfaces - `internal/interfaces/cli/acp_wiring_test.go`: Update wiring tests with SDK fakes - `pkg/acpserver/` (10 files): Delete custom ACP server package superseded by SDK - `tests/integration/acp/acp_goroutine_leak_test.go`: Adapt goroutine leak test to SDK server - `tests/integration/acp/acp_jsonrpc_e2e_test.go`: Update e2e test for SDK transport - `tests/integration/acp/acp_serve_functional_test.go`: Add functional integration test suite - `tests/integration/acp/testhelpers_test.go`: Update test helpers for SDK server setup Closes #367
e3ce139 to
8afce0b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pkg/acpserverpackage (~590-line custom JSON-RPC/SSE server) with the upstreamgithub.com/coder/acp-go-sdk, eliminating ~2,000 lines of bespoke protocol code that duplicated what the SDK providesAgent(session lifecycle),Emitter(SDK event dispatch),PermissionClient(tool-approval requests), and a simplifiedRendererthat writes directly to SDK streamsShutdownnow permanently tears down session context rather than only interrupting the current run, andNewSessioncorrectly validates the type assertion on the session ID fieldacp_serve_functional_test.go) and architecture enforcement tests that were previously absentChanges
Removed — custom ACP server package
pkg/acpserver/server.go: Deleted (~590 lines of custom JSON-RPC/SSE server)pkg/acpserver/protocol.go: Deleted (custom framing protocol)pkg/acpserver/types.go: Deleted (custom request/response types)pkg/acpserver/doc.go: Deletedpkg/acpserver/architecture_test.go: Deletedpkg/acpserver/goroutine_leak_test.go: Deletedpkg/acpserver/protocol_test.go: Deletedpkg/acpserver/server_test.go: Deletedpkg/acpserver/types_test.go: Deletedpkg/acpserver/writeframe_internal_test.go: Deletedinternal/infrastructure/acp/message.go: Deleted (custom message DTOs replaced by SDK types)internal/infrastructure/acp/message_test.go: DeletedInfrastructure — new SDK adapters
internal/infrastructure/acp/agent.go: NewAgenthandler implementing session create/resume/run against the SDKinternal/infrastructure/acp/agent_test.go: Unit tests forAgentcovering success, validation errors, and type assertion edge casesinternal/infrastructure/acp/emitter.go: NewEmitterwrapping SDK connection to dispatchSessionUpdateevents; extractedsessionUpdaterinterface for testabilityinternal/infrastructure/acp/emitter_internal_test.go: Internal tests forEmitterinternalsinternal/infrastructure/acp/emitter_test.go: Behavioural tests forEmitterwith fake connectioninternal/infrastructure/acp/errors.go: CentralizedACPHandlerErrortransport-neutral error typeinternal/infrastructure/acp/errors_test.go: Tests for error construction and unwrappinginternal/infrastructure/acp/permission.go: NewPermissionClienthandling tool-approval round-trips via the SDKinternal/infrastructure/acp/permission_test.go: Tests forPermissionClientincluding error propagationinternal/infrastructure/acp/architecture_test.go: New architecture enforcement tests (SDK import confinement, documentation drift detection)internal/infrastructure/acp/doc_test.go: Public surface and documentation coverage testsinternal/infrastructure/acp/event_projector.go: Updated to consume SDK event types instead of custom message structsinternal/infrastructure/acp/event_projector_test.go: Revised to match new SDK-based projectorinternal/infrastructure/acp/renderer.go: Simplified to emit directly to SDK streams; added concurrency invariant documentationinternal/infrastructure/acp/renderer_test.go: Substantially refactored to match simplified renderer surfaceinternal/infrastructure/acp/doc.go: Rewritten to document new component decomposition and SDK integration contractApplication — session service fixes
internal/application/acp_session.go: Updated session lifecycle;Shutdownpermanently tears down contextinternal/application/acp_session_service.go: Wired new SDK-backed adapters; improvedNewSessionresult validationinternal/application/acp_session_service_parking_test.go: New parking/prompt-routing test coverageinternal/application/acp_session_service_test.go: Expanded to coverNewSessionerror paths and session ID validationinternal/application/acp_session_service_concurrency_test.go: Minor updates for renamed typesinternal/application/acp_audit_fixes_test.go: Minor updatesCLI wiring
internal/interfaces/cli/acp_serve.go: Updated serve command to wire SDK server instead of custom server; fixed signal-watch goroutine lifetimeinternal/interfaces/cli/acp_serve_lifecycle_test.go: New lifecycle tests for server startup/shutdown sequenceinternal/interfaces/cli/acp_serve_test.go: Revised to match new wiring surfaceinternal/interfaces/cli/acp_wiring.go: Simplified; removedpkg-acpserverdependency, wires SDK components directlyinternal/interfaces/cli/acp_wiring_test.go: Updated withsync/atomicimport forstreamFlaggingEmittertestsArchitecture & configuration
.go-arch-lint.yml: Removedpkg-acpservercomponent; addedgo-sdk-acpvendor; updatedinfra-acpdependency rulesgo.mod/go.sum: Addedgithub.com/coder/acp-go-sdkdependencyTests — integration
tests/integration/acp/acp_serve_functional_test.go: New end-to-end functional suite covering session create, run, streaming, and shutdown flowstests/integration/acp/acp_jsonrpc_e2e_test.go: Updated to use SDK-based servertests/integration/acp/acp_goroutine_leak_test.go: Updated for SDK lifecycletests/integration/acp/testhelpers_test.go: Refactored test helpers for SDK server setupDocumentation
docs/ADR/020-acp-server-migration-to-coder-sdk.md: New ADR documenting the migration rationale, tradeoffs, and SDK adoption decisiondocs/ADR/018-acp-transparent-agent-server-protocol.md: Minor update to reference ADR-020docs/ADR/README.md: Added entry for ADR-020CHANGELOG.md: Release entry for F105README.md: Updated feature statusZPM knowledge base
.zpm/kb/pr_feature_f105_acp_server_migration_to_coderacp_go_s/journal.wal: PR tracking journal.zpm/kb/pr_feature_f105_acp_server_migration_to_coderacp_go_s/knowledge.pl: Prolog knowledge facts for this PRTest plan
make buildproduces a clean binary with no compilation errorsmake testpasses including the newacp_serve_functional_test.gofunctional suite and all unit tests forAgent,Emitter,PermissionClient, andRenderermake lintreports zero violations; architecture lint confirmsinfra-acpno longer importspkg-acpserverand only the SDK vendor is usedawf acp-servestarts an ACP server, accepts a session, processes a prompt, and streams events correctly end-to-endCloses #367
Generated with awf commit workflow